package org.pz.controller;

import com.baomidou.dynamic.datasource.DynamicRoutingDataSource;
import com.baomidou.dynamic.datasource.annotation.DS;
import org.pz.entity.MallResult;
import org.pz.mapper.DataSourceMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 超级接口
 * */
@RequestMapping("/interface")
@RestController
public class InterfaceController {

    @Autowired
    private DataSourceMapper dataSourceMapper;

    @Resource
    private DynamicRoutingDataSource dataSource;

    /**
     * 测试数据源用的
     * */
    @RequestMapping("/test")
    @DS("pz")
    public MallResult test() {
        return MallResult.success( dataSourceMapper.findDataSource() );
    }

    /**
     * 新增接口
     * */
    @RequestMapping("/add")
    public MallResult add() {
        return MallResult.success();
    }

}
